$(function () {


  $.ajax({
    url: '/user/queryUserMessage',
    type: 'get',
    success: function (info) {
      console.log(info)
      if (info.error === 400) {
        location.href = 'login.html'
      } else {
        $('.userInfo').html(template('tmp', info))
      }
    }
  })

  $('.logout').on('click', function () {
    $.ajax({
      url: '/user/logout',
      type: 'get',
      success: function (info) {
        if (info.success) {
          location.href = 'login.html'
        }
      }
    })
  })
})